<?php

namespace App\Task\Update;

use App\Model\Setting\SettingAppHidden;
use Hyperf\Crontab\Annotation\Crontab;

/**
 * App功能隐藏配置更新
 * @Crontab(name="UpdateFuncforbidTask", rule="55 6,19 * * *", callback="execute", memo="App功能隐藏配置更新", singleton=false, enable=false)
 */
class UpdateFuncforbidTask
{
    public function execute()
    {
        log_info(__CLASS__ . "==Start==" . date('Y-m-d H:i:s'));
        $hour = date('H', time());
        if (intval($hour) < 10) {
            SettingAppHidden::where(['flag' => 0])->update(['flag' => 1]);
        } elseif (intval($hour) > 18) {
            SettingAppHidden::where(['flag' => 1])->update(['flag' => 0]);
        }
    }
}
